package module.building.view.panelUtils
{
	import com.darwin.darwinUI.controls.Label;
	import com.darwin.darwinUI.core.UIComponent;
	import com.darwin.darwinUI.general.DarwinFont;
	import com.darwin.darwinUI.general.TextFieldFactory;
	import com.darwin.darwinUI.uiconst.UIAlign;
	
	public class IconLabel extends UIComponent
	{
		private var _icon:UIComponent;
		private var _label:Label;
		
		public function IconLabel(skin:String,string:String="",label:Label = null)
		{
			//		this.autoSize = true;
			this.width = 27;
			this.height = 34;
			
			//		this.graphics.lineStyle(0);
			//		this.graphics.drawRect(0,0,27,34);
			//		this.graphics.endFill();
			if(label)
			{
				_label = label;
				width = 35;
				_label.y = 22;
			}else
			{
				_label = TextFieldFactory.getInstance().getLabel("buildInterface_label_costNumber",[string]);
				_label.y = 18;
			}
			_label.autoSize = true;
			
			_icon = new UIComponent();
			_icon.backgroundAuto = true;
			_icon.backgroundSkin = skin;
			if(skin != "")
			{
				_icon.width = _icon.background.width;
				_icon.height = _icon.background.height;
				_icon.x = (width-_icon.width)/2;
			}
			
			
			addChild(_icon);
			addChild(_label);
		}
		
		public function get text():String
		{
			return _label.text;
		}
		
		public function set text(string:String):void
		{
			_label.text = string;
			_label.x = (width-_label.width)/2;
		}
		
		public function get textColor():uint
		{
			return _label.textColor;
		}
		
		public function set textColor(color:uint):void
		{
			_label.textColor = color;
		}
	}
}